<?php
	require_once("../../library/function/connect.php");
	require_once("../../library/function/MasterTool.php");
	$obj = new MasterTool();
	
	$name = mysql_real_escape_string(strip_tags($_POST['name']));
	$user = mysql_real_escape_string(strip_tags($_POST['user']));
	$pass = sha1(mysql_real_escape_string(strip_tags($_POST['pass'])));
	$email = mysql_real_escape_string(strip_tags($_POST['email']));
	$level = 2;
	$create_date = $obj->CurrentDate() . " " . $obj->CurrentTime();
	
	$query = mysql_query(" INSERT INTO thanhvien(user, pass, name, email, level, create_date)
							VALUES('$user', '$pass', N'$name', '$email', '$level', '$create_date') ");
	
	if($query)
		echo "0";
	else	
		echo "1";
?>